import Vue from "vue";
import VueRouter from "vue-router";
import EmptyComponent from "../modules/utils/EmptyComponent";
import Mev from "../plugins/mev/mev";
import Log from "../plugins/utils/log";

Vue.use(VueRouter);

const routes = [{ path: "/", name: "EmptyComponent", component: EmptyComponent }];

Mev.Modules.forEach(module => {
    module.functions.forEach(func => {
        let route = { path: "/" + func.component.name, name: func.component.name, component: func.component };
        routes.push(route);
        Log.debug("添加路由 路径: " + route.path + ", 文件: " + route.component.__file);
    });
});

Mev.ToolbarModules.forEach(func => {
    let route = {
        path: "/" + func.component.name,
        name: func.component.name,
        component: func.component
    };
    routes.push(route);
    Log.debug("添加路由 路径: " + route.path + ", 文件: " + route.component.__file);
});

var path = require("path");
var fs = require("fs");
var filePath = path.resolve("./pak");

const router = new VueRouter({
    routes
});

export default router;
